home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 26.zip / BS1 part 26 / C for beginners.adf / source / fprint-fscan.c < prev    next >
C/C++ Source or Header  |  1978-01-17  |  542b  |  26 lines

  1. /*fprint-fscan.c 23.2.1 */
  2. #include <stdio.h>
  3.  
  4. main()
  5. {
  6.    FILE *input, *output, *fopen();
  7.    char filename[81], text[200];
  8.  
  9.    printf("Please input file name!\n");
  10.    scanf("%80s", filename);
  11.    printf("Input a (long) word!\n");
  12.    scanf("%200s", text);
  13.  
  14.    output = fopen(filename, "w");
  15.    printf("Filehandle %d\n", output);
  16.    fprintf(output, "%s", text);
  17.    fclose(output);
  18.  
  19.    input = fopen(filename, "r");
  20.    printf("Filehandle %d\n", input);
  21.    fscanf(input, "%200s", text);
  22.    fclose(input);
  23.    printf("The Text: >%s<\n", text);
  24. }
  25.  
  26.